﻿using System;
using System.ComponentModel;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Web.UI.WebControls.Expressions;
using CommunityToolkit.Mvvm.ComponentModel;


namespace FixtureManageSystem.Models
{
    public class WareHouseIn: ObservableObject
    {
        /// 条形码
        private string barCode;
        public string BarCode
        {
            get => barCode;
            set => SetProperty(ref barCode, value);
        }

        /// <summary>
        /// 名称
        /// </summary>
        private string name = String.Empty;
        public string Name
        {
            get => name;
            set => SetProperty(ref name, value);
        }

        /// <summary>
        /// 物料型号
        /// </summary>
        /// <param name="factory"></param>

        private string materialType = String.Empty;
        public string MaterialType
        {
            get => materialType;
            set => SetProperty(ref materialType, value);
        }

        // 存放库位
        private string position;
        public string Position
        {
            get => position;
            set => SetProperty(ref position, value);
        }

        /// <summary>
        /// 责任人
        /// </summary>

        private string personNo = String.Empty;
        public string PersonNo
        {
            get => personNo;
            set => SetProperty(ref personNo, value);
        }

        private string personName = String.Empty;
        public string PersonName
        {
            get => personName;
            set => SetProperty(ref personName, value);
        }


        // 入库日期
        private DateTime inTime = DateTime.Now.Date;
        public DateTime InTime
        {
            get => inTime;
            set => SetProperty(ref inTime, value);
        }


        //入库数量
        private int num = 1;
        public int Num
        {
            get => num;
            set => SetProperty(ref num, value);
        }

        //唯一性ID
        private int id;
        public int Id
        {
            get => id;
            set => SetProperty(ref id, value);
        }
         

        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is WareHouseIn))
                return false;

            WareHouseIn other = (WareHouseIn)obj;
            return Id == other.Id && Name == other.Name && Num == other.Num
                 && Position == other.Position && InTime == other.InTime && PersonName == other.PersonName
                 && PersonNo == other.personNo && MaterialType == other.MaterialType && BarCode == other.barCode;
        }

        public static bool operator ==(WareHouseIn s1, WareHouseIn s2)
        {
            if (object.ReferenceEquals(s1, s2))
                return true;

            if ((object)s1 == null || (object)s2 == null)
                return false;

            return s1.Equals(s2);
        }

        public static bool operator !=(WareHouseIn s1, WareHouseIn s2)
        {
            return !(s1 == s2);
        }
    }
}
